import request from '@/utils/request.js'

export function getpostList(page, size, searchParams) {
  console.log('page',page,'size',size)
  return request.get(`/post/list/${page}/${size}`, {
    params: {
      title: searchParams?.title,
      delFlag: searchParams?.status
    }
  })
}

/**
 * 删除帖子id
 * @param postId
 */
export function remove(postId) {
  return request.delete(`/post/remove/${postId}`)
}
/**
 * 批量删除帖子信息
 *
 * @param ids
 */
export function removeBatchByPostIds(attrIds) {
  console.log('批量删除帖子信息ids=====',attrIds)
  return request.delete('/post/batch', {
    data: attrIds
  })
}
/**
 * 新增帖子信息
 * @param post
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function addPost(post) {
  return request.post('/post/add', post)
}
/**
 * 修改帖子信息
 * @param userInfo
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function updatePost(post) {
  console.log('修改帖子信息11111',post)
  return request.put('/post/update', post)
}

/**
 * 详情
 * @param postId
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function detail(postId) {
  return request.get(`/post/detail/${postId}`)
}
